package bean.loader;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import bean.JenisKeretaApiBean;

public class JenisKeretaApiLoader implements BeanLoader<JenisKeretaApiBean>{

	@Override
	public List<JenisKeretaApiBean> loadList(ResultSet rs) throws SQLException {
		List<JenisKeretaApiBean> list = new ArrayList<JenisKeretaApiBean>();
		while(rs.next())
			list.add(loadSingle(rs));
		return list;
	}

	@Override
	public JenisKeretaApiBean loadSingle(ResultSet rs) throws SQLException {
		JenisKeretaApiBean bean = new JenisKeretaApiBean();
		bean.setIdJenisKa(rs.getString("id_jenis_ka"));
		bean.setMaxSpeed(rs.getFloat("max_speed"));
		return bean;
	}

	@Override
	public PreparedStatement loadParameters(PreparedStatement ps,
			JenisKeretaApiBean bean) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

}
